package com.gf.nams.util.page;

public class PaginationContext {
	
	private static ThreadLocal<PaginationContext> local = new ThreadLocal<PaginationContext>() {
		protected PaginationContext initialValue() {
			return new PaginationContext();
		};
	};

	private Page pagingParameter;

	public Page getPagingParameter() {
		return pagingParameter;
	}

	public void setPagingParameter(Page pagingParameter) {
		this.pagingParameter = pagingParameter;
	}

	public boolean isPaged() {
		return pagingParameter != null;
	}

	public static PaginationContext current() {
		return local.get();
	}
	
	public static void clear() {
		PaginationContext current = current();
		current.pagingParameter = null;
	}
	
}
